|
|
|
| Table 6.1 Data Types for Variables. | | Data Type | Range | | Boolean | 2 bytes. Range: True or False. | | Byte | 1 byte. Range: 0 to 255. | | Date | 8-byte floating point. Range: Jan. 1, 100 to December 31, 9999 and 0:00:00 to 23:59:59. | | Integer (%) | 2 bytes. Range: 32,768 to 32,767. | | Long (&) | 4 bytes. Range: 2,147,483,648 to 2, 147,483,647. | | Single (!) | 4 bytes. Range: 3.402823E38 to 1.401298E-45 for negative values. Range: 1.4011298E-45 to 3.40282E38 for positive values. | | Double (#) | 8 bytes. Range: 1.79769313486232E308 to 4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values. | | Currency (@) | 8 bytes. Range: 922,337,203,685,477.5808 to 922,337,203,685,477.5807. | | String ($) | A string is stored as a Unicode string. This takes 2 bytes per character to store, plus some overhead for a Visual Basic pointer. | | Variant | A variant can be any of the preceding data types, plus objects, Null, and Empty. This is the default type for any undeclared variables. |
|
|
|
|
|
|
The symbols in parentheses listed after each type are what old Visual Basic programmers used to use to declare a variable as a specific type. This type of nomenclature should not be used anymore and is only presented here in case you come across it in some of the trade journals. Here are some examples: |
|
|
|
 |
|
|
|
|
Loop% = 1
Name$ = "John Doe"
Count& = 159999 |
|
|
|
|
|